package com.ylbh.modules.member.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ylbh.common.pojo.member.dto.MemberPlayerDTO;
import com.ylbh.common.utils.Query;
import com.ylbh.modules.member.mapper.MemberPlayerMapper;
import com.ylbh.modules.member.service.MemberPlayerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ylbh.common.utils.PageUtils;

import java.util.Map;

@Service("memberPlayerService")
public class MemberPlayerServiceImpl extends ServiceImpl<MemberPlayerMapper, MemberPlayerDTO> implements MemberPlayerService {
    @Autowired
    private MemberPlayerMapper memberPlayerMapper;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MemberPlayerDTO> page = this.page(
                new Query<MemberPlayerDTO>().getPage(params),
                new QueryWrapper<MemberPlayerDTO>()
        );

        return new PageUtils(page);
    }

    /**
     * 查询大玩家剩余次数
     * @param id
     * @return
     */
    @Override
    public Integer getCountByUserId(Long id) {
        return memberPlayerMapper.getCountByUserId(id);
    }

//    @Override
//    public boolean add(MemberPlayerDTO entity) {
//        return memberPlayerMapper.add(entity);
//    }
}